const groups = [
  {
    id: 1,
    parentId: 0,
    ifLeaf: null,
    taskId: null,
    taskType: null,
    parentPath: null,
    path: "数据异常识别-专题",
    orderNo: 0,
    label: "数据异常识别-专题",
    metamodelId: null,
    name: "数据异常识别-专题",
    icon: null,
    code: "TEST-THEME-001",
    builtin: null,
    description: "",
    projectId: 10002,
    orgId: 1,
    creator: 10000,
    createTime: "2023-07-05 09:03:51",
    children: [
      {
        id: 2,
        parentId: 1,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据异常识别专题",
        path: "数据异常识别专题/供水管网多级压力异常识别",
        orderNo: 0,
        label: "供水管网多级压力异常识别",
        metamodelId: null,
        name: "供水管网多级压力异常识别",
        icon: null,
        code: "SUPPORT-MULTI-UNNORMAL-RECOGNISE-PRESS",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 1,
        creator: 10000,
        createTime: "2023-07-05 10:37:17",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 2,
      },
      {
        id: 17,
        parentId: 1,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据异常识别-专题",
        path: "数据异常识别-专题/终端用水数据异常识别模型",
        orderNo: 0,
        label: "终端用水数据异常识别模型",
        metamodelId: null,
        name: "终端用水数据异常识别模型",
        icon: null,
        code: "CODE-001-001",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 1,
        creator: 10000,
        createTime: "2025-11-11 16:11:29",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 17,
      },
      {
        id: 18,
        parentId: 1,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据异常识别-专题",
        path: "数据异常识别-专题/用户异常使用识别模型",
        orderNo: 0,
        label: "用户异常使用识别模型",
        metamodelId: null,
        name: "用户异常使用识别模型",
        icon: null,
        code: "CODE-001-006",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 1,
        creator: 10000,
        createTime: "2025-11-11 16:14:53",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 18,
      },
      {
        id: 19,
        parentId: 1,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据异常识别-专题",
        path: "数据异常识别-专题/供水管网冗余压力准稳态分析模型",
        orderNo: 0,
        label: "供水管网冗余压力准稳态分析模型",
        metamodelId: null,
        name: "供水管网冗余压力准稳态分析模型",
        icon: null,
        code: "CODE-001-005",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 1,
        creator: 10000,
        createTime: "2025-11-11 16:14:53",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 19,
      },
      {
        id: 20,
        parentId: 1,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据异常识别-专题",
        path: "数据异常识别-专题/听漏仪漏损识别模型",
        orderNo: 0,
        label: "听漏仪漏损识别模型",
        metamodelId: null,
        name: "听漏仪漏损识别模型",
        icon: null,
        code: "CODE-001-008",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 1,
        creator: 10000,
        createTime: "2025-11-11 16:14:53",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 20,
      },
      {
        id: 21,
        parentId: 1,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据异常识别-专题",
        path: "数据异常识别-专题/泵站设备异常运行状态识别模型",
        orderNo: 0,
        label: "泵站设备异常运行状态识别模型",
        metamodelId: null,
        name: "泵站设备异常运行状态识别模型",
        icon: null,
        code: "CODE-001-004",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 1,
        creator: 10000,
        createTime: "2025-11-11 16:14:53",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 21,
      },
      {
        id: 22,
        parentId: 1,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据异常识别-专题",
        path: "数据异常识别-专题/排水管网非常规运行状态管段级识别模型",
        orderNo: 0,
        label: "排水管网非常规运行状态管段级识别模型",
        metamodelId: null,
        name: "排水管网非常规运行状态管段级识别模型",
        icon: null,
        code: "CODE-001-007",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 1,
        creator: 10000,
        createTime: "2025-11-11 16:14:53",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 22,
      },
      {
        id: 3,
        parentId: 1,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据异常识别专题",
        path: "数据异常识别专题/供水管网多级流量异常识别",
        orderNo: 1,
        label: "供水管网多级流量异常识别",
        metamodelId: null,
        name: "供水管网多级流量异常识别",
        icon: null,
        code: "SUPPORT-MULTI-UNNORMAL-RECOGNISE-FLOW",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 1,
        creator: 10000,
        createTime: "2023-07-10 15:24:42",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 3,
      },
    ],
    disabled: false,
    leaf: null,
    attributes: null,
    type: 0,
    value: 1,
  },
  {
    id: 7,
    parentId: 0,
    ifLeaf: null,
    taskId: null,
    taskType: null,
    parentPath: null,
    path: "数据预测模型-专题",
    orderNo: 11,
    label: "数据预测模型-专题",
    metamodelId: null,
    name: "数据预测模型-专题",
    icon: null,
    code: "CODE-00001",
    builtin: null,
    description: "",
    projectId: 10002,
    orgId: 4,
    creator: 10000,
    createTime: "2025-11-11 16:05:38",
    children: [
      {
        id: 23,
        parentId: 7,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据预测模型-专题",
        path: "数据预测模型-专题/供水系统多级需水量预测模型",
        orderNo: 0,
        label: "供水系统多级需水量预测模型",
        metamodelId: null,
        name: "供水系统多级需水量预测模型",
        icon: null,
        code: "CODE-002-001",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 4,
        creator: 10000,
        createTime: "2025-11-11 16:16:33",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 23,
      },
      {
        id: 29,
        parentId: 7,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据预测模型-专题",
        path: "数据预测模型-专题/终端用户需水量预测模型",
        orderNo: 2,
        label: "终端用户需水量预测模型",
        metamodelId: null,
        name: "终端用户需水量预测模型",
        icon: null,
        code: "CODE-002-002",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 4,
        creator: 10000,
        createTime: "2025-11-11 16:19:30",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 29,
      },
      {
        id: 24,
        parentId: 7,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据预测模型-专题",
        path: "数据预测模型-专题/供水系统水质预测模型",
        orderNo: 3,
        label: "供水系统水质预测模型",
        metamodelId: null,
        name: "供水系统水质预测模型",
        icon: null,
        code: "CODE-002-003",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 4,
        creator: 10000,
        createTime: "2025-11-11 16:19:30",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 24,
      },
      {
        id: 27,
        parentId: 7,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据预测模型-专题",
        path: "数据预测模型-专题/供水系统水龄预测模型",
        orderNo: 4,
        label: "供水系统水龄预测模型",
        metamodelId: null,
        name: "供水系统水龄预测模型",
        icon: null,
        code: "CODE-002-004",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 4,
        creator: 10000,
        createTime: "2025-11-11 16:19:30",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 27,
      },
      {
        id: 26,
        parentId: 7,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据预测模型-专题",
        path: "数据预测模型-专题/排水管网溢流预测模型",
        orderNo: 5,
        label: "排水管网溢流预测模型",
        metamodelId: null,
        name: "排水管网溢流预测模型",
        icon: null,
        code: "CODE-002-005",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 4,
        creator: 10000,
        createTime: "2025-11-11 16:19:30",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 26,
      },
      {
        id: 25,
        parentId: 7,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据预测模型-专题",
        path: "数据预测模型-专题/排水管网流量预测模型",
        orderNo: 6,
        label: "排水管网流量预测模型",
        metamodelId: null,
        name: "排水管网流量预测模型",
        icon: null,
        code: "CODE-002-006",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 4,
        creator: 10000,
        createTime: "2025-11-11 16:19:30",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 25,
      },
      {
        id: 28,
        parentId: 7,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据预测模型-专题",
        path: "数据预测模型-专题/展示柜外抱电圈测流量",
        orderNo: 7,
        label: "展示柜外抱电圈测流量",
        metamodelId: null,
        name: "展示柜外抱电圈测流量",
        icon: null,
        code: "CODE-002-007",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 4,
        creator: 10000,
        createTime: "2025-11-11 16:19:30",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 28,
      },
      {
        id: 30,
        parentId: 7,
        ifLeaf: null,
        taskId: null,
        taskType: null,
        parentPath: "数据预测模型-专题",
        path: "数据预测模型-专题/内涝点水位预测模型",
        orderNo: 8,
        label: "内涝点水位预测模型",
        metamodelId: null,
        name: "内涝点水位预测模型",
        icon: null,
        code: "CODE-002-008",
        builtin: null,
        description: "",
        projectId: 10002,
        orgId: 4,
        creator: 10000,
        createTime: "2025-11-11 16:19:30",
        children: [],
        disabled: false,
        leaf: null,
        attributes: null,
        type: 1,
        value: 30,
      },
    ],
    disabled: false,
    leaf: null,
    attributes: null,
    type: 0,
    value: 7,
  },
  {
    id: 8,
    parentId: 0,
    ifLeaf: null,
    taskId: null,
    taskType: null,
    parentPath: null,
    path: "智能控制模型-专题",
    orderNo: 12,
    label: "智能控制模型-专题",
    metamodelId: null,
    name: "智能控制模型-专题",
    icon: null,
    code: "CODE-00002",
    builtin: null,
    description: "",
    projectId: 10002,
    orgId: 4,
    creator: 10000,
    createTime: "2025-11-11 16:05:38",
    children: [],
    disabled: false,
    leaf: null,
    attributes: null,
    type: 0,
    value: 8,
  },
  {
    id: 9,
    parentId: 0,
    ifLeaf: null,
    taskId: null,
    taskType: null,
    parentPath: null,
    path: "视频数据识别模型库系统-专题",
    orderNo: 13,
    label: "视频数据识别模型库系统-专题",
    metamodelId: null,
    name: "视频数据识别模型库系统-专题",
    icon: null,
    code: "CODE-00003",
    builtin: null,
    description: "",
    projectId: 10002,
    orgId: 4,
    creator: 10000,
    createTime: "2025-11-11 16:05:38",
    children: [],
    disabled: false,
    leaf: null,
    attributes: null,
    type: 0,
    value: 9,
  },
  {
    id: 10,
    parentId: 0,
    ifLeaf: null,
    taskId: null,
    taskType: null,
    parentPath: null,
    path: "语音对话模型库系统-专题",
    orderNo: 14,
    label: "语音对话模型库系统-专题",
    metamodelId: null,
    name: "语音对话模型库系统-专题",
    icon: null,
    code: "CODE-00004",
    builtin: null,
    description: "",
    projectId: 10002,
    orgId: 4,
    creator: 10000,
    createTime: "2025-11-11 16:05:38",
    children: [],
    disabled: false,
    leaf: null,
    attributes: null,
    type: 0,
    value: 10,
  },
  {
    id: 11,
    parentId: 0,
    ifLeaf: null,
    taskId: null,
    taskType: null,
    parentPath: null,
    path: "知识图谱系统-专题",
    orderNo: 15,
    label: "知识图谱系统-专题",
    metamodelId: null,
    name: "知识图谱系统-专题",
    icon: null,
    code: "CODE-00005",
    builtin: null,
    description: "",
    projectId: 10002,
    orgId: 4,
    creator: 10000,
    createTime: "2025-11-11 16:05:38",
    children: [],
    disabled: false,
    leaf: null,
    attributes: null,
    type: 0,
    value: 11,
  },
  {
    id: 12,
    parentId: 0,
    ifLeaf: null,
    taskId: null,
    taskType: null,
    parentPath: null,
    path: "排水管网模型接入系统-专题",
    orderNo: 16,
    label: "排水管网模型接入系统-专题",
    metamodelId: null,
    name: "排水管网模型接入系统-专题",
    icon: null,
    code: "CODE-00006",
    builtin: null,
    description: "",
    projectId: 10002,
    orgId: 4,
    creator: 10000,
    createTime: "2025-11-11 16:05:38",
    children: [],
    disabled: false,
    leaf: null,
    attributes: null,
    type: 0,
    value: 12,
  },
  {
    id: 14,
    parentId: 0,
    ifLeaf: null,
    taskId: null,
    taskType: null,
    parentPath: null,
    path: "代理模型库系统-专题",
    orderNo: 18,
    label: "代理模型库系统-专题",
    metamodelId: null,
    name: "代理模型库系统-专题",
    icon: null,
    code: "CODE-00008",
    builtin: null,
    description: "",
    projectId: 10002,
    orgId: 4,
    creator: 10000,
    createTime: "2025-11-11 16:05:38",
    children: [],
    disabled: false,
    leaf: null,
    attributes: null,
    type: 0,
    value: 14,
  },
  {
    id: 15,
    parentId: 0,
    ifLeaf: null,
    taskId: null,
    taskType: null,
    parentPath: null,
    path: "供水调度模拟仿真实验室系统-专题",
    orderNo: 19,
    label: "供水调度模拟仿真实验室系统-专题",
    metamodelId: null,
    name: "供水调度模拟仿真实验室系统-专题",
    icon: null,
    code: "CODE-00009",
    builtin: null,
    description: "",
    projectId: 10002,
    orgId: 4,
    creator: 10000,
    createTime: "2025-11-11 16:05:38",
    children: [],
    disabled: false,
    leaf: null,
    attributes: null,
    type: 0,
    value: 15,
  },
  {
    id: 16,
    parentId: 0,
    ifLeaf: null,
    taskId: null,
    taskType: null,
    parentPath: null,
    path: "仿真实验室系统-专题",
    orderNo: 20,
    label: "仿真实验室系统-专题",
    metamodelId: null,
    name: "仿真实验室系统-专题",
    icon: null,
    code: "CODE-000010",
    builtin: null,
    description: "",
    projectId: 10002,
    orgId: 4,
    creator: 10000,
    createTime: "2025-11-11 16:05:38",
    children: [],
    disabled: false,
    leaf: null,
    attributes: null,
    type: 0,
    value: 16,
  },
  {
    id: 31,
    parentId: 0,
    ifLeaf: null,
    taskId: null,
    taskType: null,
    parentPath: null,
    path: "其他",
    orderNo: 110,
    label: "其他",
    metamodelId: null,
    name: "其他",
    icon: null,
    code: "CODE-110",
    builtin: null,
    description: "",
    projectId: 10002,
    orgId: 4,
    creator: 10000,
    createTime: "2025-11-11 16:30:04",
    children: [],
    disabled: false,
    leaf: null,
    attributes: null,
    type: 0,
    value: 31,
  },
];
const relations = {
  智能控制: [
    "供水系统单泵单目标优化调度模型",
    "供水系统单泵多目标优化调度模型",
    "排水系统泵群多目标优化调度模型",
    "净水厂“能-药”双耗优化模型",
  ],
  视频数据: [
    "站房异常事件识别模型",
    "图片/视频超标识别模型",
    "多孔径雷达漏损识别模型",
    "OCR-控制柜展示页面识别",
    "OCR-智能识别水表模型",
    "OCR-新区工单识别",
  ],
  语音对话: ["语音客服工单分类模型", "系统展示语音助手模型"],
  知识图谱: [
    "供水系统常规调度知识图谱",
    "供水系统应急调度知识图谱",
    "泵站运维知识图谱",
  ],
  排水管网: ["水流模拟与预测", "水位分析与预测", "负荷分析"],
  代理模型: [
    "管网水力模型代理模型",
    "排水系统模型代理模型",
    "水利模型代理模型",
  ],
  供水调度: [
    "调度效果推演子系统",
    "单目标调度方案生成子系统",
    "多目标调度方案生成子系统",
  ],
  仿真实验: [
    "水质全过程模拟（水源地-水厂-用户）",
    "新安江模型（河流径流模拟）",
  ],
  其他: [
    "地下管道超声波信号",
    "水质溯源",
    "埋地管道腐蚀剩余寿命预测",
    "雨水管网溢流分析",
    "设备预防性维护",
    "排水管道堵塞",
  ],
};

for (const [category, items] of Object.entries(relations)) {
  console.log("--", category);
  for (const item of items) {
    const itemId = items.indexOf(item) + 1;
    console.log("----", itemId, item);
    for (let i = 0; i < groups.length; i++) {
      const g = groups[i];
      if (g.children.length > 0) continue;
      const gName = g.name;
      if (!gName.startsWith(category)) {
        continue;
      }
      const gID = g.id;

      // const bodyInfo = `{\"orgId\":4,\"parentId\":${gID},\"parentPath\":\"${gName}\",\"path\":\"\",\"name\":\"${item}\",\"code\":\"CODE-00${itemId+10}-00${itemId+2}\",\"type\":1,\"orderNo\":${itemId+2},\"description\":\"\",\"id\":\"\"}`
      const bodyInfoEnhance = `{\"orgId\":1,\"parentId\":${gID},\"parentPath\":\"${gName}\",\"path\":\"${gName}/${item}\",\"name\":\"${item}\",\"code\":\"CODE-00${
        itemId + 10
      }-00${itemId + 2}\",\"type\":1,\"orderNo\":${
        itemId + 2
      },\"description\":\"\",\"id\":\"\",\"projectId\":10002,\"version\":3,\"deleted\":0,\"creator\":10000,\"createTime\":\"2023-07-05 10:37:17\",\"updater\":10000,\"updateTime\":\"2025-11-05 15:24:51\"}`;
      console.log(bodyInfoEnhance);
      fetch("http://1.62.163.250:49079/dataCenter-api/data-assets/catalog/", {
        headers: {
          accept: "application/json, text/plain, */*",
          "accept-language": "zh-CN",
          authorization: "35957261a6cd4a40bdc5f0704efe48a7",
          "cache-control": "no-cache",
          "content-type": "application/json;charset=UTF-8",
          pragma: "no-cache",
        },
        referrer: "http://1.62.163.250:49079/apps-dataCenter/",
        body: bodyInfoEnhance,
        method: "POST",
        mode: "cors",
        credentials: "include",
      });
    }
  }
}
